package com.yzd.learnjava.concurrency;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

import com.yzd.learnjava.util.Print;

public class SleepingTask extends LiftOff {
	public void run() {
		try {
			while(countDown-- > 0) {
				Print.print(status());
				TimeUnit.MILLISECONDS.sleep(100);
			}
		} catch (Exception e) {
			Print.print("Interupted");
		}
	}
	
	
	public static void main(String[] args) {
		ExecutorService exec = Executors.newCachedThreadPool();
		for(int i = 0 ; i < 5; i++) {
			exec.execute(new SleepingTask());
		}
		exec.shutdown();
	}
}
